package com.testmodelconnectionapp;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by ${张英杰} on 2018/10/26.
 */

public class MsgBean implements Parcelable {
    String msg1;
    String msg2;

    //最好显示定义，防止变更。
    private static final long serialVersionUID = 4359709211352400087L;


    public String getMsg1() {
        return msg1;
    }

    public void setMsg1(String msg1) {
        this.msg1 = msg1;
    }

    public String getMsg2() {
        return msg2;
    }

    public void setMsg2(String msg2) {
        this.msg2 = msg2;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.msg1);
        dest.writeString(this.msg2);
    }

    //todo 使用out tag序列化的时候一定要有下面的函数
    public void readFromParcel(Parcel in) {
        msg1 = in.readString();
        msg2 = in.readString();
    }

    public MsgBean() {
    }

    protected MsgBean(Parcel in) {
        this.msg1 = in.readString();
        this.msg2 = in.readString();
    }

    public static final Parcelable.Creator<MsgBean> CREATOR = new Parcelable.Creator<MsgBean>() {
        @Override
        public MsgBean createFromParcel(Parcel source) {
            return new MsgBean(source);
        }

        @Override
        public MsgBean[] newArray(int size) {
            return new MsgBean[size];
        }
    };

    @Override
    public String toString() {
        return "MsgBean{" +
                "msg1='" + msg1 + '\'' +
                ", msg2='" + msg2 + '\'' +
                '}';
    }
}
